package com.lt.flashcard.model.entity;

import java.util.Date;
import java.util.List;

import org.bson.types.ObjectId;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;

/**
 * Store the test data
 * @author ocsen
 * @version 1.0
 * @created 01-Nov-2012 14:10:36
 */
@Entity("testsuite")
public class Testsuite {

	@Id
	private ObjectId id;
	private String name;
	/**
	 * The status of the test
	 */
	private int status = STATUS_DRAFT;
	/**
	 * The test suite is already created by system
	 */
	public static final int STATUS_DRAFT = 0;
	/**
	 * The test suite is on going
	 */
	public static final int STATUS_START = 1;
	/**
	 * The test suite finished
	 */
	public static final int STATUS_FINISH = 2;
	/**
	 * The test suite canceled
	 */
	public static final int STATUS_CANCEL = 3;
	/**
	 * The type of this test suite
	 */
	private int type = TYPE_TESTLEARNED;
	/**
	 * Test learned words
	 */
	public static final int TYPE_TESTLEARNED = 0;
	/**
	 * Test all words
	 */
	public static final int TYPE_TESTALL = 1;
	/**
	 * The date this test is created
	 */
	private Date created;
	/**
	 * The time that user begin the test
	 */
	private Date takeon;
	/**
	 * User id
	 */
	private Long uid;
	/**
	 * Total number of questions for this test
	 */
	private int totalquestion = 0;
	private int totalmultichoice = 0;
	private int totalmatching = 0;
	private int totaltyping = 0;
	/**
	 * The result
	 */
	private int resultscore = 0;
	/**
	 * The time that finish this test, in second
	 */
	private int resulttime = 0;
	private int totalwords = 0; //total number of words
	private int resultrightwords = 0; //total number of right words
	/**
	 * The maximum time for this test, in second
	 */
	private int maxtime = 0;
	/**
	 * The maximum score for this test suite
	 */
	private int maxscore = 0;
	/**
	 * Current question of the test that user is taking
	 */
	private int currentquestion = -1;
	/**
	 * Store the data for this test
	 */
	private String note = "";
	
	private Long flashcardsetid;
	/**
	 * List of test cases
	 */
	private List<Testcase> testcases;
	
	public ObjectId getId() {
		return id;
	}
	
	public void setId(ObjectId id) {
		this.id = id;
	}
	
	public int getStatus() {
		return status;
	}
	
	public void setStatus(int status) {
		this.status = status;
	}
	
	public Date getCreated() {
		return created;
	}
	
	public void setCreated(Date created) {
		this.created = created;
	}
	
	public Date getTakeon() {
		return takeon;
	}
	
	public void setTakeon(Date takeon) {
		this.takeon = takeon;
	}
	
	public Long getUid() {
		return uid;
	}
	
	public void setUid(Long uid) {
		this.uid = uid;
	}
	
	public int getTotalquestion() {
		return totalquestion;
	}
	
	public void setTotalquestion(int totalquestion) {
		this.totalquestion = totalquestion;
	}
	
	public int getResultscore() {
		return resultscore;
	}
	
	public void setResultscore(int resultscore) {
		this.resultscore = resultscore;
	}
	
	public int getResulttime() {
		return resulttime;
	}
	
	public void setResulttime(int resulttime) {
		this.resulttime = resulttime;
	}
	
	public int getMaxtime() {
		return maxtime;
	}
	
	public void setMaxtime(int maxtime) {
		this.maxtime = maxtime;
	}
	
	public int getCurrentquestion() {
		return currentquestion;
	}
	
	public void setCurrentquestion(int currentquestion) {
		this.currentquestion = currentquestion;
	}
	
	public String getNote() {
		return note;
	}
	
	public void setNote(String note) {
		this.note = note;
	}
	
	public List<Testcase> getTestcases() {
		return testcases;
	}
	
	public void setTestcases(List<Testcase> testcases) {
		this.testcases = testcases;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getMaxscore() {
		return maxscore;
	}

	public void setMaxscore(int maxscore) {
		this.maxscore = maxscore;
	}

	public int getTotalmultichoice() {
		return totalmultichoice;
	}

	public void setTotalmultichoice(int totalmultichoice) {
		this.totalmultichoice = totalmultichoice;
	}

	public int getTotalmatching() {
		return totalmatching;
	}

	public void setTotalmatching(int totalmatching) {
		this.totalmatching = totalmatching;
	}

	public int getTotaltyping() {
		return totaltyping;
	}

	public void setTotaltyping(int totaltyping) {
		this.totaltyping = totaltyping;
	}
	
	/**
	 * Return current testcase
	 * @return
	 */
	public Testcase getCurrentTestcase() {
		int cur = getCurrentquestion();
		if(cur < 0 || cur >= getTestcases().size())
			return null;
		return getTestcases().get(cur);
	}

	public Long getFlashcardsetid() {
		return flashcardsetid;
	}

	public void setFlashcardsetid(Long flashcardsetid) {
		this.flashcardsetid = flashcardsetid;
	}

	public int getTotalwords() {
		return totalwords;
	}

	public void setTotalwords(int totalwords) {
		this.totalwords = totalwords;
	}

	public int getResultrightwords() {
		return resultrightwords;
	}

	public void setResultrightwords(int resultrightwords) {
		this.resultrightwords = resultrightwords;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}